<template>
  <div>
    <!-- 附件表五 基本信息及燃耗信息 add by qzn 20190710  -->
    <mt-header fixed title="道路货物运输量专项调查" style="z-index: 999999;">
      <span slot="left" @click="goBack">
        <mt-button icon="back" slot="left">返回</mt-button>
      </span>
      <mt-button  v-if="(reportedByOther==1&&information=='调查员'||reportedByOther==0&&information=='业户')" icon slot="right" @click.native="insertDate">新增</mt-button>
    </mt-header>
    <el-table border :data="tableData4" style="width: 100%" max-height="450">
      <el-table-column fixed prop="xh" label="序号" width="50" align="center"></el-table-column>
      <el-table-column prop="cphm" label="车牌号码" width="80" align="center"></el-table-column>
      <el-table-column prop="cpys" label="车牌颜色" width="80" align="center"></el-table-column>
      <el-table-column prop="cllx" label="车辆类型" width="80" align="center"></el-table-column>
      <el-table-column prop="bjdw" label="标记吨位(吨)" width="120" align="center"></el-table-column>
      <el-table-column prop="zzl" label="总质量(吨)" width="120" align="center"></el-table-column>
      <el-table-column prop="rllx" label="燃料类型" width="80" align="center"></el-table-column>
      <el-table-column prop="qtrllxmc" label="其他燃料类型名称" width="80" align="center"></el-table-column>
      <el-table-column prop="dcq" label="调查期" width="80" align="center"></el-table-column>
      <el-table-column prop="dcqq" label="调查期起" width="120" align="center"></el-table-column>
      <el-table-column prop="dcqz" label="调查期止" width="120" align="center"></el-table-column>
      <el-table-column prop="xslc" label="行驶里程(公里)" width="80" align="center"></el-table-column>
      <el-table-column prop="dcqqlcbds" label="调查期起里程表读数" width="120" align="center"></el-table-column>
      <el-table-column prop="dcqzlcbds" label="调查期止里程表读数" width="120" align="center"></el-table-column>
      <el-table-column prop="nh" label="能耗(升/立方米/千克/千万时)" width="120" align="center"></el-table-column>
      <el-table-column prop="bglnhjyz" label="百公里能耗经验值(升/立方米/千克/千瓦时)" width="120" align="center"></el-table-column>
      <el-table-column label="操作" width="120" align="center">
        <template slot-scope="scope">
          <el-button
            @click.native.prevent="deleteRow(scope.$index, tableData4)"
            type="text"
            size="small"
          >移除</el-button>
          <el-button @click.native.prevent="updateRow(scope.$index)" type="text" size="small">修改</el-button>
        </template>
      </el-table-column>
    </el-table>
    <table style="margin:3%">
        <tr v-for = '(item,i) in errorMessage'>
             <td style="color:blue" @click="showInputPopup(item,i)">{{item}}</td>
        </tr>    
    </table>
    <mt-popup
      v-model="popupVisibleReason"
      popup-transition="popup-fade"
      closeOnClickModal="true"
      position="bottom">
      <div class="picker-toolbar-title" style="width:100%">
          <div class="usi-btn-cancel" @click="popupVisibleReason = !popupVisibleReason">取消</div>
          <div class="usi-btn-sure" @click="check">确定</div>
        </div>
      <div style="margin:8px">{{this.text}}</div>
      <el-input type="textarea" placeholder="请输入原因" v-model="reason" style="margin-bottom:10px;" rows="5"></el-input>
      
    </mt-popup>
  </div>
</template>
      
<script>
import { Toast, MessageBox } from "mint-ui";

export default {
  data() {
    return {
      errorMessage: [],
      numMessage: [],
      popupVisibleReason: false,//弹窗状态
      text:"",//公式
      numInfo:"",
      reason:"",
      xh: 0, //序号
      tableData4: [
        {
          recid: "",
          floatorder: "",
          xh: '',
          cphm:'',// 车牌号码
          cpys: "", // 车牌颜色
          cllx: "", // 车辆类型
          bjdw: "", // 标记吨位
          zzl: "", // 总质量
          rllx: "", //燃料类型
          qtrllxmc:"",//qita燃料类型名称
          dcq: "", // 调查期
          dcqq: "", // 调查期起
          dcqz: "", //调查期止
          xslc: "", //行驶里程
          dcqqlcbds: "", // 调查期起里程表读数
          dcqzlcbds: "", // 调查期止里程表读数
          nh: "", // 能耗
          bglnhjyz: "", // 百公里能耗经验值
        }
      ],
      // 根据公司状态判定新增按钮是否显示 add by qzn 20190625
      reportedByOther: this.$route.query.reportedByOther,
      information:this.$route.query.information
    };
  },
  watch: {},
  mounted() {
    this.getCode();
  },
  methods: {
    showInputPopup(item,i){      
      if(JSON.stringify(item).indexOf("逻辑性") == -1){
        this.popupVisibleReason = true;
        console.log("名称："+JSON.stringify(item)+"编号："+this.numMessage[i]);
        this.text = JSON.stringify(item);
        this.numInfo = this.numMessage[i];
        this.getReason();
      }
    },
    checkStringLen(str){
      let flag = false;
      let len = 0;
      let len1 = 0;
      for (var i = 0; i < str.length; i++) {
          let length = str.charCodeAt(i);
          if(length>=0&&length<=128) {
              len += 1;                    
          } else {
              len1 += 2;                    
          }
      }
      if(len1 < 20){
          flag = true;
          console.log("原因长度"+len1);   
      }
      return flag;
    },
    check(){
      if(this.reason == "" || this.reason == undefined){
        Toast("原因不能为空！");
      } else if(this.checkStringLen(this.reason)){
        Toast("原因不能少于十个汉字！");
      } else {
        this.reasonSure();
      }
    },
    reasonSure(){
      console.log("输入原因："+this.reason);      
        this.axios
            .post(
              "http://zxdc.catsic.com:9090/sampling/errorStatement/saveErrorMessage",
              {
                data: {
                  formula: this.numInfo,
                  yhmlk: localStorage.getItem("id"),
                  errorDesc: this.reason,
                }
              },
              {
                headers: {
                  "Content-Type": "application/json",
                  mobileHeader:
                    '{"sessionId":' + localStorage.getItem("sessionId") + "}"
                }
              }
            )
            .then(result => {
              if (result.data.status === "1000") {
                console.log("审核原因:"+JSON.stringify(result));
                Toast("保存成功");
                this.popupVisibleReason = false;
              } else {
                Toast("保存失败");
              }
            });
    },
    getReason(){
        this.axios
            .post(
              "http://zxdc.catsic.com:9090/sampling/errorStatement/showErrorMessage",
              {
                data: {
                  formula: this.numInfo,
                  yhmlk: localStorage.getItem("id")
                }
              },
              {
                headers: {
                  "Content-Type": "application/json",
                  mobileHeader:
                    '{"sessionId":' + localStorage.getItem("sessionId") + "}"
                }
              }
            )
            .then(result => {
              console.log(result);
              if (result.data.status === "1000") {
                if(result.data.data.errorMessage == ""){
                  this.reason = "";
                } else {
                  this.reason = result.data.data.errorMessage.errordesc;
                }               
              }
            });
    },
    goBack() {
      //点击后退
      this.$router.go(-1);
    },
    getCode() {
      let data = {};
      data.yhmlkRecid = this.$route.query.yhmlk;    
      this.axios
        .post(
          "http://zxdc.catsic.com:9090/sampling/assit/findFzdcbfd05",
          { data: data },
          {
            headers: {
              "Content-Type": "application/json",
              mobileHeader:
                '{"sessionId":' + localStorage.getItem("sessionId") + "}"
            }
          }
        )
        .then(
          result => {
            if (result.data.status == "1000") {
              console.log("辅助表5-基本情况-总数据返回："+JSON.stringify(result))
              this.tableData4.splice(0);
              
              if(result.data.data.MSG == "没有查询到结果"){                  
              } else {
                   this.xh = 0;
                   this.errorMessage = [];
                  result.data.data.Fzdcbfd05.forEach(item => {
                    let tableData = {};
                    tableData.recid = item.recid;
                    tableData.floatorder = item.floatorder;
                    tableData.xh = ++this.xh;
                    (tableData.cphm = item.fzdcbfd52019001), // 车牌号码                    
                    (tableData.cpys = this.getCarColorName(item.fzdcbfd52019002)), // 车牌颜色
                    (tableData.cllx = this.getCarTypeNmae(item.fzdcbfd52019003)), // 车辆类型
                    (tableData.bjdw = item.fzdcbfd52019004), // bjdw
                    (tableData.zzl = item.fzdcbfd52019005), // 总质量
                    (tableData.rllx = this.getfuleTypeNmae(item.fzdcbfd52019006)),                    
                    (tableData.qtrllxmc = item.fzdcbfd52019024),
                    (tableData.dcq = this.getDcqName(item.fzdcbfd52019007)), // 调查期
                    (tableData.dcqq = item.fzdcbfd52019008), // 调查期起
                    (tableData.dcqz = item.fzdcbfd52019009), // 调查期止                  
                    (tableData.xslc = item.fzdcbfd52019010), // 行驶里程                  
                    (tableData.dcqqlcbds = item.fzdcbfd52019011), // 调查期起里程表读数                  
                    (tableData.dcqzlcbds = item.fzdcbfd52019012), // 调查期止里程表读数
                    (tableData.nh = item.fzdcbfd52019013), // 能耗
                    (tableData.bglnhjyz = item.fzdcbfd52019014), // 百公里能耗经验值
                    this.tableData4.push(tableData);
                    //校验公式
                    if(tableData.cphm == ""){
                      this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：车牌号码不能为空，请修改！");
                      this.numMessage.push("[JUI6HUY6][FZB5]F1");
                    }
                    if(tableData.cpys == "" || tableData.cpys == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：车牌颜色不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F2");
                    }
                    if(tableData.cllx == "" || tableData.cllx == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：车辆类型不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F7");
                    }
                    if((tableData.cllx == "整车" || tableData.cllx == "集装箱车" || tableData.cllx == "冷藏保温车" || tableData.cllx == "其他") && (tableData.bjdw == undefined||tableData.bjdw == "")){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：标记吨位不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F6");
                    }
                    if(tableData.bjdw != undefined||tableData.bjdw != ""){
                      if(parseFloat(tableData.bjdw) < 0.1 || parseFloat(tableData.bjdw)>=80){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：标记吨位（吨）填写时应大于等于0.1且小于80，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F13");
                      }
                    }
                    if((tableData.cllx == "整车" || tableData.cllx == "集装箱车" || tableData.cllx == "冷藏保温车" || tableData.cllx == "其他") && (tableData.zzl == undefined||tableData.zzl == "")){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：总质量不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F9");
                    }
                    if(tableData.zzl != undefined||tableData.zzl != ""){
                      if(parseFloat(tableData.zzl) < 1 || parseFloat(tableData.zzl)>=150){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：总质量应大于等于1且小于150，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F112");
                      }
                      if(tableData.bjdw != undefined||tableData.bjdw != ""){
                        if(parseFloat(tableData.zzl) <= parseFloat(tableData.bjdw)){
                          this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：总质量应大于标记吨位，请修改！");
                          this.numMessage.push("[JUI6HUY6][FZB5]F113");
                        }
                        let result = parseFloat(tableData.zzl)-parseFloat(tableData.bjdw);
                        if(result<0.5 || result > 50){
                          this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：车辆自重（总质量减去标记吨位）应大于等于0.5吨且小于等于50吨，请修改！");
                          this.numMessage.push("[JUI6HUY6][FZB5]F114");
                        }
                      }
                    }

                    if(tableData.rllx == "" || tableData.rllx == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：燃料类型不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F11");
                    }
                    if(tableData.rllx == "其他" && (tableData.qtrllxmc == undefined||tableData.qtrllxmc == "")){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：其他燃料类型名称不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F12");
                    }
                    if(tableData.dcq == "" || tableData.dcq == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：调查期不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F15");
                    }
                    if(tableData.dcq == "其他" && ((tableData.dcqq == undefined||tableData.dcqq == "")||(tableData.dcqz == undefined||tableData.dcqz == ""))){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：调查期起止时间不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F59");
                    }                    
                    if(tableData.dcqq != "" && tableData.dcqz != "" && tableData.dcqq != undefined && tableData.dcqz != undefined){
                        let result = this.compareTime(tableData.dcqq, tableData.dcqz);
                        if(result){
                            this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：调查期起应早于调查期止，请修改！");
                            this.numMessage.push("---");
                        }
                    }

                    if((tableData.xslc == "" || tableData.xslc == undefined)  && ((tableData.dcqqlcbds == undefined||tableData.dcqqlcbds == "")||(tableData.dcqzlcbds == undefined||tableData.dcqzlcbds == ""))){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：总行驶里程与调查期起、止里程表读数至少填一项，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F68");
                    }
                    if(tableData.dcqqlcbds != "" && tableData.dcqqlcbds != undefined &&(tableData.dcqzlcbds == undefined||tableData.dcqzlcbds == "")){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：调查期止里程表读数不能为空，请修改！");
                        this.numMessage.push("---");
                    }
                    if((tableData.nh == "" || tableData.nh == undefined) && (tableData.bglnhjyz == "" || tableData.bglnhjyz == undefined)){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：能耗与百公里能耗经验值至少填一项，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F64");
                    }
                    if(tableData.nh != "" && tableData.nh != undefined){
                        if(parseFloat(tableData.nh) > 0 && (tableData.xslc == "" || tableData.xslc == undefined)){
                            this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：当能耗大于0时，总行驶里程应大于0，请修改！");
                            this.numMessage.push("---");
                        } else if(parseFloat(tableData.nh) > 0 && parseFloat(tableData.xslc) <= 0){
                            this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：当能耗大于0时，总行驶里程应大于0，请修改！");
                            this.numMessage.push("---");
                        }
                    }
                    if(tableData.nh != "" && tableData.nh != undefined && tableData.xslc != "" && tableData.xslc != undefined && tableData.bglnhjyz != "" && tableData.bglnhjyz != undefined){
                        let result = (parseFloat(tableData.nh)/parseFloat(tableData.xslc))*100-parseFloat(tableData.bglnhjyz);
                        if(result > 0.1 || result < -0.1){
                            this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：能百公里能耗经验值=能耗/总行驶里程*100，请修改！");
                            this.numMessage.push("---");
                        }
                    }
                    //标记吨位、燃料类型不为空时，
                    if(tableData.bjdw != "" && tableData.rllx != ""){
                        if(parseFloat(tableData.bjdw) <= 2){
                            if(tableData.rllx == "汽油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <5 || parseFloat(tableData.bglnhjyz) > 30)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F23");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位2吨及以下且燃料类型为汽油的货车的百公里燃耗取值范围一般在[5,30]之间，请核实！");
                                }
                            } else if(tableData.rllx == "柴油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <5 || parseFloat(tableData.bglnhjyz) > 30)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F35");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位2吨及以下且燃料类型为柴油的货车的百公里燃耗取值范围一般在[5,30]之间，请核实！");
                                }
                            }
                        } else if(parseFloat(tableData.bjdw) > 2 && parseFloat(tableData.bjdw) <= 4){
                            if(tableData.rllx == "汽油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <12 || parseFloat(tableData.bglnhjyz) > 42)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F43");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位介于(2,4]之间且燃料类型为汽油的货车的百公里燃耗取值范围一般在[12,42]之间，请核实！");
                                }
                            } else if(tableData.rllx == "柴油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <10 || parseFloat(tableData.bglnhjyz) > 35)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F44");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位介于(2,4]之间且燃料类型为柴油的货车的百公里燃耗取值范围一般在[10,35]之间，请核实！");
                                }
                            }
                        } else if(parseFloat(tableData.bjdw) > 4 && parseFloat(tableData.bjdw) < 8){
                            if(tableData.rllx == "汽油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <18 || parseFloat(tableData.bglnhjyz) > 48)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F46");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位介于(4,8)之间且燃料类型为汽油的货车的百公里燃耗取值范围一般在[18,48]之间，请核实！");
                                }
                            } else if(tableData.rllx == "柴油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <15 || parseFloat(tableData.bglnhjyz) > 40)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F47");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位介于(4,8)之间且燃料类型为柴油的货车的百公里燃耗取值范围一般在[15,40]之间，请核实！");
                                }
                            }
                        } else if(parseFloat(tableData.bjdw) >= 8 && parseFloat(tableData.bjdw) < 20){
                            if(tableData.rllx == "汽油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <24 || parseFloat(tableData.bglnhjyz) > 54)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F48");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位介于[8,20)之间且燃料类型为汽油的货车的百公里燃耗取值范围一般在[24,54]之间，请核实！");
                                }
                            } else if(tableData.rllx == "柴油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <20 || parseFloat(tableData.bglnhjyz) > 70)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F51");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位介于[8,20)之间且燃料类型为柴油的货车的百公里燃耗取值范围一般在[20,70]之间，请核实！");
                                }
                            }
                        } else if(parseFloat(tableData.bjdw) >= 20 && parseFloat(tableData.bjdw) < 35){
                            if(tableData.rllx == "汽油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <30 || parseFloat(tableData.bglnhjyz) > 70)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F52");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位介于[20,35)之间且燃料类型为汽油的货车的百公里燃耗取值范围一般在[30,70]之间，请核实！");
                                }
                            } else if(tableData.rllx == "柴油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <25 || parseFloat(tableData.bglnhjyz) > 70)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F54");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位介于[20,35)之间且燃料类型为柴油的货车的百公里燃耗取值范围一般在[25,70]之间，请核实！");
                                }
                            }
                        } else if(parseFloat(tableData.bjdw) >= 35){
                            if(tableData.rllx == "汽油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <36 || parseFloat(tableData.bglnhjyz) > 70)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F55");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位介于[35,+)之间且燃料类型为汽油的货车的百公里燃耗取值范围一般在[36,70]之间，请核实！");
                                }
                            } else if(tableData.rllx == "柴油"){
                                if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <30 || parseFloat(tableData.bglnhjyz) > 70)){
                                    this.numMessage.push("[JUI6HUY6][FZB5]F56");
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：标记吨位介于[35,+)之间且燃料类型为柴油的货车的百公里燃耗取值范围一般在[30,70]之间，请核实！");
                                }
                            }
                        }
                    }
                    if(tableData.cllx == "牵引车" && (tableData.rllx == "汽油" || tableData.rllx == "柴油")){
                        if(tableData.bglnhjyz != "" && (parseFloat(tableData.bglnhjyz) <5 || parseFloat(tableData.bglnhjyz) > 80)){
                            this.numMessage.push("[JUI6HUY6][FZB5]F105");
                            this.errorMessage.push("序号"+tableData.xh+" 核实性错误：牵引车的汽油或柴油百公里燃耗取值应该在[5,80]之间，请核实！");
                        }
                    }                    
                });        
                localStorage.setItem("baseInfo",JSON.stringify(this.tableData4));        
              }              
            }            
          },
          error => {
            console.log("getyhcars request error:" + error);
          }
        );    
    },
    insertDate() {
      this.$router.push({
        path: "/home/auxiliaryTableFiveBaseInfoInsert/:yhmlk",
        query: { yhmlk: this.$route.query.yhmlk }
      });
    },
    deleteRow(index) {
      let data = {};
      data.recid = this.tableData4[index].recid;
      console.log('recid-->>'+data.recid)
      this.axios
        .post(
          "http://zxdc.catsic.com:9090/sampling/assit/deleteFzdcbfd05",
          { data: data },
          {
            headers: {
              "Content-Type": "application/json",
              mobileHeader:
                '{"sessionId":' + localStorage.getItem("sessionId") + "}"
            }
          }
        )
        .then(
          result => {
            if (result.data.status == "1000") {
              this.getCode();
              console.log(result);
            }
          },
          error => {
            console.log("getyhcars request error:" + error);
          }
        );
      this.getCode();
    },
    updateRow(index) {
      this.$router.push({
        path: "/home/auxiliaryTableFiveBaseInfoUpdate/:yhmlk/:recid/:floatorder",
        query: {
          yhmlk: this.$route.query.yhmlk,
          recid: this.tableData4[index].recid,
          floatorder: this.tableData4[index].floatorder
        }
      });
    }, 
    getCarTypeNmae(code) {// 获取货物类型名称显示在表格 add by qzn 20190704  
      var carTypes = [
        {
        "code": "1",
        "name": "整车",
      },
      {
        "code": "1.1",
        "name": "集装箱车",
      },
      {
        "code": "1.2",
        "name": "冷藏保温车",
      },
      {
        "code": "1.3",
        "name": "其他",
      },
      {
        "code": "2",
        "name": "牵引车",
      },
      ];
      var name;
      carTypes.forEach(item => {
        if (item.code === code) {
          name = item.name;
        }
      });
      return name;
    },
    // 获取车牌颜色名称
                getCarColorName(code) {
                  var goodsTypes = [
                    {
                      code: "1",
                      name: "蓝色"
                    },
                    {
                      code: "2",
                      name: "黄色"
                    },
                    {
                      code: "3",
                      name: "黑色"
                    },
                    {
                      code: "4",
                      name: "白色"
                    },
                    {
                      code: "5",
                      name: "黄绿"
                    },
                    {
                      code: "6",
                      name: "渐变绿"
                    },
                    {
                      code: "9",
                      name: "其他"
                    }
                  ];
                  var name;
                  goodsTypes.forEach(item => {
                    if (item.code === code) {
                      name = item.name;
                    }
                  });
                  return name;
              },
    getDcqName(code) { 
      var carTypes = [
        {
        "code": "1",
        "name": "上旬（1-10日）",
      },
      {
        "code": "2",
        "name": "中旬（11-20日）",
      },
      {
        "code": "3",
        "name": "下旬（21-30日）",
      },
      {
        "code": "4",
        "name": "整月",
      },
      {
        "code": "9",
        "name": "其他",
      },
      ];
      var name;
      carTypes.forEach(item => {
        if (item.code === code) {
          name = item.name;
        }
      });
      return name;
    },
    getGoodsTypeNmae(code) {// 获取货物类型名称显示在表格 add by qzn 20190704  
      var goodsTypes = [
        {
          code: "1",
          name: "煤炭及制品"
        },
        {
          code: "2",
          name: "金属矿石"
        },
        {
          code: "3",
          name: "矿建材料及水泥"
        },
        {
          code: "4",
          name: "机械设备电器"
        },
        {
          code: "5",
          name: "轻工医药产品"
        },
        {
          code: "6",
          name: "鲜活农产品"
        },
        {
          code: "9",
          name: "其他"
        }
      ];
      var name;
      goodsTypes.forEach(item => {
        if (item.code === code) {
          name = item.name;
        }
      });
      return name;
    },
    getfuleTypeNmae(code) {// 获取货物类型名称显示在表格 add by qzn 20190704  
      var goodsTypes = [
        {
          code: "1",
          name: "汽油"
        },
        {
          code: "2",
          name: "柴油"
        },
        {
          code: "3",
          name: "压缩天然气"
        },
        {
          code: "4",
          name: "液化天然气"
        },
        {
          code: "5",
          name: "电"
        },
        {
          code: "6",
          name: "其他"
        }
      ];
      var name;
      goodsTypes.forEach(item => {
        if (item.code === code) {
          name = item.name;
        }
      });
      return name;
    },
    //比较时间大小
    compareTime(beginDate, endDate) {
      var beginDate = beginDate;
      var endDate = endDate;
      var d1 = new Date(beginDate.replace(/\-/g, "/"));
      var d2 = new Date(endDate.replace(/\-/g, "/"));
      if (d1 >= d2) {
        return true;
      } else {
        return false;
      }
    },
  }
};
</script>
 <style lang="scss" scoped>
.tb {
  padding-top: 10px;
}

.mint-cell {
  background-color: #efeff4;
}
input[type="number"] {
  line-height: 21px;
  width: 100%;
  height: 40px;
  margin-bottom: 0px;
  padding: 10px 15px;
  -webkit-user-select: text;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  outline: 0;
  background-color: #fff;
  -webkit-appearance: none;
}
.button {
  padding-top: 3%;
  padding-left: 5%;
  padding-right: 5%;
  padding-bottom: 5%;
}
.picker-toolbar-title {
  display: flex;
  flex-direction: row;
  background-color: #007aff;
  justify-content: space-around;
  height: 40px;
  line-height: 40px;
  font-size: 16px;
  width: 100%;
}
.usi-btn-cancel,
.usi-btn-sure {
  color:white;
}
.mint-popup-bottom {
  width: 100%;
  top: auto;
  right: auto;
  bottom: 0;
}
</style>